package strex;

/**
 * @author: knowno
 * @create: 2025-09-15 08:35
 * @Version 1.0
 **/
public class TestString3 {
    public static void main(String[] args) {
        //字符串拼接 常量池
        String str = "ILoveJava";
        String str1 = "I";
        String str2 = "Love";
        String str3 = "Java";
        //比较的是地址  + 的是 变量 =>内部处理,存内存堆
        System.out.println(str == (str1 + str2 + str3)); //false

        String str4 = "I" + "Love" + "Java"; //常量池
        System.out.println(str == str4);
    }
}
